perm filename SIGIII.MAC[8,ALS] blob sn#047804 filedate 1973-06-08 generic text, type T, neo UTF8
00010	TITLE SIG
00020	
00030	ENTRY SIG
00040	
00050		;Signature table processing routine.
00060		;Version with line by line computation and spreading for P tables.
00070		;Also contains TABLET section added on June 12 1972.
00080		;Addapted for ripple learning May 30 1973.
00085		;Multiple set of input tables as of June 6 1973. (indicated by ****)
00090	
00100	EXTERNAL TABLES,HINT,UPCNT
00110	EXTERNAL INDAT,INCNT,FLAG
00120	EXTERNAL STX,STXX
00130	
00140	;    Name   Rel. Loc.	Usage
00150		OUT=0		;Most recent table output in leftmost bits
00160		SIGTYP=1	;3 fields,Table type,No of inputs,Gate sign and level
00170		LEARN=2		;4 PH numbers if Q table or pointer to feature if P
00180		GATE=3		;Gating byte pointer
00190		IN1=4		;Byte pointer to first input
00200		IN2=5		;Byte pointer to second input
00210		IN3=6		;Byte pointer to third input
00220		IN4=7		;Byte pointer to fourth input
00230		IN5=10		;Byte pointer to fifth input
00240		IN6=11		;Byte pointer to sixth input
00250		SIGTAB=12	;Start of actual table
00260	
00270	EXTERNAL	TABLET,SEGC,TFLAG
00280	
00290	;Index register assignments
00300	;Regester	Usage
00310	Z=0		; general purpose register
00320	I=1		;Used to index between tables (incremented by 74)
00330	J=2		;Used to index within  tables
00340	K=3		;Special purpose indexing and general use when Z not wanted
00350	L=4
00360	M=5		;Used to hold counter bit
00370	N=6
00380	P=7		;Used to index INDAT files
00390	Q=10		;Used to hold mask
00400	R=11		;Used to hold quantized marker
00410	S=12
00420	T=13		;Reserved exclusively for the address of the first word in TABLES
00430	F=14
00440	H=15		;Used to hold HINT word repeated in right 3 6-bit fields
00450	PO=16		;NO LONGER USED
00460	X=17		;Used to index in buckets
00470	
00480	SIG:	0
00490		MOVEM	17,SAVE+17
00500		MOVE	17,[XWD 0,SAVE]
00510		BLT	17,SAVE+16
00520	
00530	TIN1:	MOVE	Z,@0(16)
00540		MOVE	T,TABLES	;Necessary for IN pointers to work
00550		MOVE	Z,TABLES
00560		ADD	Z,STX
00570		MOVEM	Z,ISAVX#
00580		MOVE	Z,TABLES
00590		ADD	Z,STXX
00600		MOVEM	Z,ISAVXX#
00610		MOVE	P,INDAT
00620	;	HRRM	Z,TIN2
00630		MOVE	Z,INCNT
00640		HRRM	Z,TIN3		;START OF INCNT
00645		HRRM	Z,TIN3+1
00650	;	HRRM	Z,.+2
00660	;	SKIPN	STXX		;Add to count only on first ripple
00670	;	AOS	0		;ADD TO INCNT ONCE ONLY
00680		MOVE	H,HINT
00690		LSH	H,6
00700		ADD	H,HINT
00710		LSH	H,6
00720		ADD	H,HINT
00730		LSH	H,6
00740		ADD	H,HINT
00750		SETZ	S,		;To index INCNT
00760		MOVEI	M,20		;Counter bit for I table
00770		MOVE	Q,[777777777760]	;Mask
00780		MOVE	I,TABLES	;To index tables
00790	TIN2:	LDB	J,IN1(I)	;Get INDAT value into index ****
00800		CAIGE	J,0		;Limit minimum to 0
00810		MOVEI	J,0
00820		CAILE	J,77		;Limit maximum to 63
00830		MOVEI	J,77
00840		ADD	J,I
00850		MOVE	K,SIGTAB(J)	
00860		MOVE	L,OUT(I)
00870		LSHC	K,-3		;Shift out oldest and add newest output
00880		MOVEM	L,OUT(I)	
00890		SKIPE	STXX		;This limits input learning to first ripple
00900		JRST	TIN6		;BYPASS IF NOT FIRST
00901		MOVE	Z,IN2(I)	;Get feature indicator word ****
00902		AND	Z,LEARN(T)	;Do we want to learn on this input ****
00906		JUMPE	Z,TIN6		; ****
00910		ADDM	M,SIGTAB(J)
00915	TIN3:	AOS	0(S)		;Count now kept here ****
00920		MOVE	N,0(S)	;Count header to determine bucket size ****
00930		CAILE	N,20000		;Stop updating at this number
00940		JRST	TIN6
00950	TIN3A:	TRNE	N,7		;Is it time to update
00960		JRST	TIN6		;No
00970		LSH	N,-3		;Divide by 8 to get number for each bucket
00980	TIN3B:	LSH	N,4		;To line up with count field
00990		MOVEI	K,77		;Use to count entries
01000		MOVE	J,I
01010		SETZ	R,		;Quantized output marker starts at 0
01020		SETZ	Z,		;To accumulate total number of references
01030	TIN4:	ANDM	Q,SIGTAB(J)	;Save count only and zero output field
01040		ADD	Z,SIGTAB(J)	;Count in current bucket
01050		ORM	R,SIGTAB(J)	;Add output field
01060		CAMGE	Z,N		;Is it time to change output marker
01070		JRST	TIN5		;No
01080		CAIGE	R,7		;Guard against too large value
01090		ADDI	R,1		;Can change safely
01100		SUB	Z,N		;Keep overshoot
01110	TIN5:	AOS	J
01120		SOJGE	K,TIN4
01130	TIN6:	ADDI	I,112		;To go to the next table
01140		AOS	S		;Keep INCNT index in step
01150		SKIPN	SIGTYP(I)	;Test table type
01160		JRST	TIN2		;Still more input tables
01170		SKIPN	STXX		;is this the first ripple
01180		JRST	FINISH		;Yes so finish
01190		MOVEM	I,ISAV#		;Save start of P-Q region in prep for update
01200	PQ1:	SKIPN	SIGTYP(I)	;A 0 value NOW means end of tables
01210		JRST	FINISH		;WAS XXX Go to tablets
01220		CAML	I,ISAVX		;Is it time to quit
01230		JRST	FINISH		;YES
01240		LDB	K,GATE(I)	;Is this table to be used
01250		LDB	L,GPOINT	;Get gating threshold
01260		SUB	K,L		;Is level high enough
01270	
01280		CAIGE	L,10		;Test for negative gate
01290		JRST	.+4
01300		ADDI	K,10
01310		JUMPLE	K,PQ2
01320		SKIPA
01330	
01340		JUMPGE	K,PQ2		; Yes
01350		LDB	L,TPOINT	; Find table type
01360		JUMPN	L,PQ1A		;Must be a Q table
01370		MOVE	L,OUT(I)	;Fix table output for gate off case
01380		LSH	L,-3		;Introuce a 0
01390		MOVEM	L,OUT(I)	;Output and go to next table
01400		JRST	PP2
01410	
01420	PQ1A:	MOVE	K,OUT(I)
01430		MOVE	L,OUT+112(I)
01440		LSHC	K,-22
01450		MOVEM	L,OUT+112(I)
01460		MOVE	L,OUT(I)
01470		LSH	L,-22		;Shift 18 places for Q table
01480		OR	L,[700000000000]	;Add the NOT-ANY output for Q table
01490		MOVEM	L,OUT(I)
01500		JRST	PQ8		;Go to next table
01510	
01520	PQ2:	LDB	J,IN1(I)	;J used to accumulate index to line
01530		LDB	K,IN2(I)
01540		LDB	L,NPOINT	;To get number of inputs from SIGDAT
01550		CAILE	L,3		;Is it a 2- or a 3-input type
01560		JRST	PQ6		;NO, it is a 6-input table
01570		CAILE	L,2		;Is it a 2 input table
01580		JRST	PQ3		;No, it has 3 inputs
01590		DPB	K,D2N2		;Deposit as 2nd of 2 inputs
01600		JRST	PQX
01610	
01620	PQ3:	DPB	K,D2N3		;Deposit as 2nd of 3 inputs
01630		LDB	K,IN3(I)
01640		DPB	K,D3N3		;Deposit as 3rd of 3
01650		JRST	PQX
01660	
01670	PQ6:	DPB	K,D2N6		;Deposit as 2nd of 6
01680		LDB	K,IN3(I)
01690		DPB	K,D3N6		;3 of 6
01700		LDB	K,IN4(I)
01710		DPB	K,D4N6		;4 of 6
01720		LDB	K,IN5(I)
01730		DPB	K,D5N6		;5 of 6
01740		LDB	K,IN6(I)
01750		DPB	K,D6N6		;6 of 6
01760	PQX:	ADD	J,I		;Add start of table I address to J
01770		LDB	K,TPOINT	;Now find whether P or Q table
01780		JUMPN	K,QQ1		;A 1 in this field means Q
01790		MOVE	K,SIGTAB(J)	;Get new output
01800		MOVE	L,OUT(I)
01810		LSHC	K,-3		;Displace oldest and add newest to left
01820		MOVEM	L,OUT(I)
01830		JUMPE	H,PP2		;A 0 in H means no learning
01840		CAMGE	I,ISAVXX	;Do we start learning
01850		JRST	PP2		;No
01860		LDB	L,LEARN(I)	;Gets proper bit from PONY word
01870		MOVSI	K,4		;Adds to not-on count
01880		SKIPE	L		;Means sig.feature not indicated
01890		MOVEI	K,20		;Adds to on count
01900		ADDM	K,SIGTAB(J)	;Add learning
01910		LDB	K,GDPNT
01920		LDB	Z,BADPNT
01930		ADD	Z,K
01940		LSH	K,4		;Multiply by 16
01950		IDIV	K,Z
01960		MOVE	Z,SPREAD(K)	;Convert to range 0 to 7
01970		DPB	Z,OTXPT		;Updated output for this entry
01980	PP2:	ADDI	I,112
01990		JRST	PQ1
02000	
02010	QQ1:	MOVE	K,OUT(I)
02020		MOVE	L,OUT+112(I)
02030		LSHC	K,-22
02040		MOVEM	L,OUT+112(I)
02050		MOVE	K,SIGTAB(J)	;Get new output
02060		MOVE	L,OUT(I)
02070		LSHC	K,-22		;18-bit fields in output for Q tables
02080		MOVEM	L,OUT(I)
02090		JUMPE	H,PQ8		;0 means no learning
02100		MOVE	Z,H
02110		XOR	Z,LEARN(I)	;Test appropiate phonemes
02120		MOVEI	K,1		;Learning add-bit if phoneme 4
02130		TRNN	Z,77		;Test last field
02140		JRST	QQ2
02150		LSH	K,11
02160		TRNN	Z,7700		;Test next field
02170		JRST	QQ2
02180		LSH	K,11
02190		TRNN	Z,770000	;Test next field
02200		JRST	QQ2
02210		LSH	K,11
02220		TLNN	Z,77
02230		JRST	QQ2
02240		MOVSI	K,1
02250		ADDM	K,SIGTAB(J)
02260		SKIPA
02270	QQ2:	ADDM	K,SIGTAB+112(J)	;Add learning count
02280		LDB	K,UPDPT		;Get update count
02290		ADDI	K,1
02300		DPB	K,UPDPT		;Automatically modulo 4
02310		CAIE	K,2		;Is it time to update this line
02320		JRST	PQ8		;No, lines updated at 2 mod 4
02330		LDB	Z,NOTPT
02340		LDB	K,PH1PT
02350		ADD	Z,K
02360		LDB	K,PH2PT
02370		ADD	Z,K
02380		LDB	K,PH3PT
02390		ADD	Z,K
02400		LDB	K,PH4PT
02410		ADD	Z,K		;Total count for line
02420		LSH	K,4		;Multiply by 16 to start
02430		IDIV	K,Z
02440		ADDI	K,1		;To round
02450		LSH	K,-1		;Now reduce range
02460		CAILE	K,7
02470		MOVEI	K,7		;Limit maximum to 7
02480		DPB	K,OT4PT
02490		MOVE	L,K
02500		MOVEI	R,4
02510		LDB	K,PH3PT		;Repeat for each component
02520		LSH	K,4
02530		IDIV	K,Z
02540		ADDI	K,1
02550		LSH	K,-1
02560		CAILE	K,7
02570		MOVEI	K,7
02580		DPB	K,OT3PT
02590		CAMG	K,L
02600		JRST	.+3
02610		MOVE	L,K
02620		MOVEI	R,3
02630		LDB	K,PH2PT	
02640		LSH	K,4
02650		IDIV	K,Z
02660		ADDI	K,1
02670		LSH	K,-1
02680		CAILE	K,7
02690		MOVEI	K,7
02700		DPB	K,OT2PT
02710		CAMG	K,L
02720		JRST	.+3
02730		MOVE	L,K
02740		MOVEI	R,2
02750		LDB	K,PH1PT
02760		LSH	K,4
02770		IDIV	K,Z
02780		ADDI	K,1
02790		LSH	K,-1
02800		CAILE	K,7
02810		MOVEI	K,7
02820		DPB	K,OT1PT
02830		CAMG	K,L
02840		JRST	.+3
02850		MOVE	L,K
02860		MOVEI	R,1
02870		LDB	K,NOTPT
02880		LSH	K,4
02890		IDIV	K,Z
02900		ADDI	K,1
02910		LSH	K,-1
02920		CAILE	K,7
02930		MOVEI	K,7
02940		DPB	K,NTOPT
02950		CAML	K,L		;Call it a not-any if equal
02960		SETZ	R,
02970		DPB	R,OTXPT
02980	PQ8:	ADDI	I,224		;Double space for Q table
02990		JRST	PQ1		;Go to next table
03000	
03010	FINISH:	MOVE	17,[XWD SAVE,0]
03020		BLT	17,17
03030		JRA	16,1(16)
03040	
03050	
03060	SAVE:	BLOCK	20
03070	SUM:	Z
03080	
03090	UPDPT:	POINT	2,SIGTAB(J),1	;Space for update record mod 4
03100	NOTPT:	POINT	16,SIGTAB(J),17
03110	PH1PT:	POINT	9,SIGTAB+112(J),8
03120	PH2PT:	POINT	9,SIGTAB+112(J),17
03130	PH3PT:	POINT	9,SIGTAB+112(J),26
03140	PH4PT:	POINT	9,SIGTAB+112(J),35
03150	
03160	OTXPT:	POINT	3,SIGTAB(J),35
03170	NTOPT:	POINT	3,SIGTAB(J),20
03180	OT1PT:	POINT	3,SIGTAB(J),23
03190	OT2PT:	POINT	3,SIGTAB(J),26
03200	OT3PT:	POINT	3,SIGTAB(J),29
03210	OT4PT:	POINT	3,SIGTAB(J),32
03220	
03230	D2N2:	POINT	3,J,32		;For depositing second input to A 2-input table
03240	D2N3:	POINT	2,J,33		;For depositing 2ND input to A 3 INPUT TABLE
03250	D3N3:	POINT	2,J,31
03260	D2N6:	POINT	1,J,34
03270	D3N6:	POINT	1,J,33
03280	D4N6:	POINT	1,J,32
03290	D5N6:	POINT	1,J,31
03300	D6N6:	POINT	1,J,30
03310	
03320	BPT3:	POINT	3,L,2		;For first 3 bits of L
03330	BPT12:	POINT	12,L,11		;For first 12 bits of L
03340	GPOINT:	POINT	4,SIGTYP(I),17	;For gating threshold from SIGTYP
03350	TPOINT:	POINT	1,SIGTYP(I),5	;For Q indicator bit in SIGTYP
03360	NPOINT:	POINT	3,SIGTYP(I),11	;For number of inputs
03370	GDPNT:	POINT	16,SIGTAB(J),31	;GOOD field for P type tables
03380	BADPNT:	POINT	16,SIGTAB(J),15	;BAD field for P type tables
03390	SPREAD:	OCT	0,0,1,1		;Can be used to spread outputs
03400		OCT	2,2,3,3
03410		OCT	4,4,5,5
03420		OCT	6,6,7,7,7
03430	
03440	
03450		END